home *** CD-ROM | disk | FTP | other *** search
/ STraTOS 1997 April & May / STraTOS 1 - 1997 April & May.iso / CD01 / INTERNET / SITES / GRAHAM / XA_6S.ZIP / SOURCE / ICONWIDG.C < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-12  |  1.7 KB  |  77 lines

  1. /*
  2.  * XaAES - XaAES Ain't the AES
  3.  *
  4.  * A multitasking AES replacement for MiNT
  5.  *
  6.  */
  7.  
  8. #include <OSBIND.H>
  9. #include <VDI.H>
  10. #include "XA_TYPES.H"
  11. #include "XA_DEFS.H"
  12. #include "XA_GLOBL.H"
  13. #include "KERNAL.H"
  14. #include "K_DEFS.H"
  15. #include "GRAF_MOU.H"
  16. #include "MESSAGES.H"
  17. #include "C_WINDOW.H"
  18. #include "RECTLIST.H"
  19. #include "ALL_WIDG.H"
  20. #include "STD_WIDG.H"
  21. #include "SYSTEM.H"
  22. #include "OBJECTS.H"
  23.  
  24. /*======================================================
  25.     ICONIFY WIDGET BEHAVIOUR
  26. ========================================================*/
  27. /* Display the iconify widget */
  28. short display_iconify(XA_WINDOW *wind, XA_WIDGET *widg)
  29. {
  30.     short x,y;
  31.  
  32.     rp_2_ap(wind, widg, &x, &y);
  33.  
  34.     if (widg->stat==XAW_PLAIN)
  35.         def_widgets[WIDG_ICONIFY].ob_state&=~SELECTED;
  36.     else
  37.         def_widgets[WIDG_ICONIFY].ob_state|=SELECTED;
  38.     
  39.     display_object(def_widgets,WIDG_ICONIFY,x,y);
  40.  
  41.     return TRUE;
  42. }
  43.  
  44. /* 
  45. */
  46. short click_iconify(XA_WINDOW *wind, XA_WIDGET *widg)
  47. {
  48.     if (wind->active_widgets&NO_MESSAGES)
  49.     {
  50.         return FALSE;
  51.     }
  52.     
  53.     switch(wind->window_status)
  54.     {
  55.         case XAWS_OPEN:            /* Window is open - send request to iconify it */
  56.             send_app_message(wind->owner, WM_ICONIFY, 0, wind->handle, iconify_x, iconify_y, iconify_w, iconify_h);
  57.         
  58.             iconify_x+=iconify_w;
  59.             if (iconify_x+iconify_w>display.x+display.w)
  60.             {
  61.                 iconify_x=0;
  62.                 iconify_y-=iconify_h;
  63.                 if (iconify_y<0)
  64.                 {
  65.                     iconify_y=display.y+display.h-iconify_h-1;
  66.                 }
  67.             }
  68.             break;
  69.             
  70.         case XAWS_ICONIFIED:    /* Window is already iconified - send request to restore it */
  71.             send_app_message(wind->owner, WM_UNICONIFY, 0, wind->handle, wind->prev_x, wind->prev_y, wind->prev_w, wind->prev_h);
  72.             break;
  73.     }
  74.     
  75.     return TRUE; /* Redisplay.... */
  76. }
  77.